package com.hopes.bizz.poll.job;

import com.hopes.bizz.poll.monitor.service.PollMonitorSiteService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author daijie
 * @version 1.0
 * @date 2023/6/1 15:19
 * @Description:
 */
@Service
@Slf4j
public class MonitorSiteJobService {

    @Autowired
    private PollMonitorSiteService pollMonitorSiteService;

    @XxlJob("monitorSiteStatusJobHandler")
    public void monitorSiteStatusJobHandler() {
        long start = System.currentTimeMillis();
        log.info("----------------监控点状态统计中----------------`");
        Boolean result = pollMonitorSiteService.monitorSiteStatusJobHandler();
        log.info("----------------监控点状态统计结束,结果为={},耗时(毫秒)={}----------------`", result, System.currentTimeMillis() - start);
        // 设置任务结果
        XxlJobHelper.handleSuccess();
    }
}
